package DaEr_5_25;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Random;
import java.util.Scanner;

public class Test3 {
    public static void main(String[] args) {
        ArrayList<String> list = new ArrayList<>();
        Collections.addAll(list,"张无忌","杨逍","赵敏","小龙女","张三丰");
        ArrayList<String> temp = new ArrayList<>(list);
        Random r = new Random();
        Scanner sc = new Scanner(System.in);
        while (true){
            if (temp.addAll(list)){
                System.out.println("重新开始一轮点名");
            }
            System.out.println("输入-1代表结束点名，否则继续点名");
            String s = sc.nextLine();
            if (s.equals("-1")){
                break;
            }
            int index = r.nextInt(temp.size());
            System.out.println(temp.get(index));
            temp.remove(temp.get(index));
        }
    }
}
